import React, { Component } from 'react'
import BetterScroll from 'better-scroll'

export default class App extends Component {
    state = {
        list:[]
    }
    render() {
        return (
            <div>
                <button onClick={ ()=>this.getData() }>add</button>
                <div className="wrapper" style={{height:'200px',background:'yellow',overflow:'hidden'}}>
                    <ul className="content">
                        {
                            this.state.list.map(item=>
                                <li key={item}>{item}</li>    
                            )
                        }
                    </ul>
                </div>
            </div>
        )
    }
    getData = ()=>{
        let newlist = [1,2,3,4,5,6,7,8,9,0,11,22,33,44,55,66,77,88,99]

        this.setState({
            list:newlist
        },()=>{
            new BetterScroll('.wrapper')
        })
    }
}
